package com.runshu.newsmartark.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class CpInvenFragmentPagerAdapter extends FragmentStatePagerAdapter {
    private ArrayList<Fragment> fragments;
    private FragmentManager fm;
    private List<String> mlist;


    public CpInvenFragmentPagerAdapter(FragmentManager fm) {
        super(fm);
        this.fm = fm;
    }


    public CpInvenFragmentPagerAdapter(FragmentManager fm, ArrayList<Fragment> fragments, List<String> mlist) {
        super(fm);
        this.fragments = fragments;
        this.fm = fm;
        this.mlist = mlist;
    }

    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    public void setFragments(ArrayList<Fragment> fragments) {
        this.fragments = fragments;
        notifyDataSetChanged();
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return  mlist.get(position);


    }
}
